package com.syg.common.context;

import com.alibaba.ttl.TransmittableThreadLocal;

import java.util.HashMap;
import java.util.Map;

/**
 * @author syg
 * @date 2021年11月25日19:15:29
 * @version 1.0
 */
public class SygRootContext {
    private static ThreadLocal<Map<String, String>> threadLocal = new TransmittableThreadLocal<Map<String, String>>() {
        @Override
        protected Map<String, String> initialValue() {
            return new HashMap<>(16);
        }
    };


    public static String put(String key, String value) {
        return (String)((Map)threadLocal.get()).put(key, value);
    }

    public static String get(String key) {
        return (String)((Map)threadLocal.get()).get(key);
    }

    public static String remove(String key) {
        return (String)((Map)threadLocal.get()).remove(key);
    }
}
